/**
 * Author:   YASUO
 * Date:     2018/8/9 10:56
 * Description:
 */
package com.rljk.common.consts;

import com.rljk.common.result.CodeMsg;
import com.rljk.exception.GlobalException;

public enum ThirdLoginEnum {

    WECHAT(1,"微信"),
    QQ(2,"QQ"),
    WEIBO(3,"微博")
    ;

    private int code;
    private String name;

    ThirdLoginEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }


    public static String getName(int code) {
        for (ThirdLoginEnum c : ThirdLoginEnum.values()) {
            if (c.getCode() == code) {
                return c.name;
            }
        }
        throw new GlobalException(CodeMsg.ENUM_NOT_FIND);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
